<template>
  <view class="content">
    <!-- 开发 -->
    <web-view @message="onMessage" id="webviewShop" :src="src"></web-view>
  </view>
</template>

<script>
import { getUserInfo } from '@/api/api';
export default {
  data() {
    return {
      wv: null,
      src: ''
    }
  },
  onLoad(opition) {
    let _this = this
  },
  onReady() {
    const self = this;
    // #ifdef APP-PLUS  
    // #endif  
    this.setSrcUrl()
  },
  onShow() {

  },

  methods: {
    setSrcUrl() {
      let _this = this
      let token = uni.getStorageSync('token')
      console.log(token, '[]');
      getUserInfo().then((res) => {
        _this.src = `https://shop.jichacha.vip/#/pages/index/index?token=${token}&id=${res.data.id}`
        console.log(_this.src, '[]');
      }).catch(err => {
        console.log(err, '[]');
        uni.$u.toast('网络超时，请稍后再试');
      })
    },
    // 接收消息  
    onMessage(e) {
      const self = this;
      console.log('我收到了网页发来的消息', e.detail.data);
      let data = e.detail.data;
    },
  }
}
</script>

<style lang="scss" scoped>
</style>
